//https://leetcode.cn/problems/compare-version-numbers/

class Solution {
public:
    int compareVersion(string version1, string version2) {
        std::vector<int> vec1;
        std::vector<int> vec2;
        std::string res;
        for(auto item:version1){
            if(item=='.'){
                vec1.push_back(stoi(res));
                res.clear();
            }else{
                res+=item;
            }
        }
        vec1.push_back(stoi(res));
        res.clear();
        for(auto item:version2){
            if(item=='.'){
                vec2.push_back(stoi(res));
                res.clear();
            }else{
                res+=item;
            }
        }
        vec2.push_back(stoi(res));
        res.clear();
        while(vec2.size()<vec1.size()){
            vec2.push_back(0);
        }
        while(vec1.size()<vec2.size()){
            vec1.push_back(0);
        }
        int val=0;
        for(size_t i=0;i<vec1.size();++i){
            if(vec1[i]<vec2[i]){
                val=-1;
                break;
            }else if(vec1[i]==vec2[i]){
                continue;
            }else{
                val=1;
                break;
            }
        }
        return val;
    }
};